import { defineStore } from 'pinia'
import methods from '../core/methods.js'
// import { login } from '../api/manager'

//存储用户信息
export const userStore = defineStore('main',{
    state:function(){
        return{
            isAdmin:'0'
        }
    },
    actions:{
       setAdmin(data){
            this.isAdmin = data
       }
    },
    getters:{},
})

//存储...忘了是什么
export const explore = defineStore('explore',{
    state:function(){
        return{
            exploreStatus:false
        }
    },
    actions:{},
    getters:{}
})

//存储面包屑页面名称
export const breadCum = defineStore('breadCum',{
    state:function(){
        return{
            curPage:null,
            tabsList:[
                {
                    path: '/',
                    name: 'home',
                    label: '首页',
                    icon: 'home'
                }
            ]
        }
    },
    actions:{
        setPage(page){
            this.curPage = page == '首页'? null : page
           let result = this.tabsList.findIndex(item => item.name == page.name)
           result == -1 ? this.tabsList.push(page) : '';
           console.log(this.tabsList);
        },
        removeTab(page){
            let closeIndex = this.tabsList.findIndex(item => item.name == page.name)
            this.tabsList.splice(closeIndex,1)
            if(this.tabsList.length == 1){ this.curPage = null}
        }
    },
    getters:{}
})